package kitrobot.com.bed.Activity;


import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;

import kitrobot.com.wechat_bottom_navigation.R;

public class StartActivity extends AppCompatActivity implements View.OnClickListener {
   /*private String id=null;
    private String name=null;
    private String phone=null;
    private String type=null;
    private String token=null;*/
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.start);
        SharedPreferences sp = getSharedPreferences("loginToken",
                Context.MODE_PRIVATE);
        String id = sp.getString("id", "");
        String phone = sp.getString("phone", "");
        String  name = sp.getString("name", "");
        String token = sp.getString("token", "");
        String type=sp.getString("type","");
        // 判断是否是之前有登录过
        if (token.length() == 0) {
            Intent intent=new Intent(this,LoginActivity.class);
            startActivity(intent);
            finish();
        } else {
            Intent intent=new Intent(this,MajorActivity.class);

            intent.putExtra("token",token);
            intent.putExtra("id",id);
            intent.putExtra("name",name);
            intent.putExtra("phone",phone);
            intent.putExtra("type",type);
            startActivity(intent);
            finish();
        }
        System.out.println("id="+id);
        System.out.println("name="+name);
        System.out.println("phone="+phone);
        System.out.println("token="+token);
    }



    @Override
    public void onClick(View view) {

    }

}
